package com.chat.biz.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chat.api.dto.AuthPullBlackDTO;
import com.chat.api.vo.AuthBlackListVO;
import com.chat.biz.service.BlackService;
import com.chat.common.page.PageParam;
import com.chat.common.result.R;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 黑名单控制器
 *
 * @author chenhao
 * @date 2025/06/09
 *//*
*功能：
 作者：chenhao
*日期： 2025/6/7 下午5:04
*/
@RestController
@RequestMapping("/black")
public class BlackController {
    @Autowired
    private BlackService blackService;
    /**
     * 页
     *
     * @param page 页
     * @return {@link R }<{@link Page }<{@link AuthBlackListVO }>>
     */
    @GetMapping("page")
    public R<Page<AuthBlackListVO>> page(@PageParam Page page){
        return R.ok(blackService.findpage(page));
    }

    /**
     * 拉黑
     *
     * @param dto 到
     * @return {@link R }<{@link Void }>
     */
    @PostMapping("pullblack")
    public R<Void> pullblack(@RequestBody @Validated AuthPullBlackDTO dto){
        blackService.pullblack(dto);
        return R.ok();
    }

    /**
     * 拉出黑名单
     *
     * @param dto 到
     * @return {@link R }<{@link Void }>
     */
    @PostMapping("pullout")
    public R<Void> pullout(@RequestBody @Validated AuthPullBlackDTO dto){
        blackService.pullout(dto);
        return R.ok();
    }

}
